﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EmbeddedSharp.Core
{
    public class TokenNotAsExpectedException : Exception
    {
        public TokenNotAsExpectedException() : base()
        {
        }

        public static string Concat(string[] args) {
            StringBuilder buff = new StringBuilder();

            for (int index = 0; index < args.Length; index++) {
                buff.Append(args[index]);
                if (index + 1 < args.Length) {
                    buff.Append(",");
                }
            }
            return buff.ToString();
        }

        public TokenNotAsExpectedException(string[] expected, string actual)
            : base(string.Format(
                "Expected is {0}, but actual is {1}",
                Concat(expected), actual))
        {
        }

        public TokenNotAsExpectedException(TokenType[] expected, string actual)
            : base(string.Format(
                "Expected is {0}, but actual is {1}",
                expected, actual)) {
        }
    }
}
